from selenium.webdriver.common.by import By


class AdminProdMngLocator:
    # 初始页面展开的tab
    default_page_expanded = (By.CSS_SELECTOR, '[aria-expanded="true"]')
    # Product Management页面tab
    product_management_tab = (By.XPATH, "//div[contains(@data-menu-id,'PRODUCT_MANAGEMENT_CRE_PLT')]")
    # Product Category页面tab
    product_category_tab = (By.CSS_SELECTOR, '[path="/console/product/category"]')
    # Marketplace Category页面tab
    marketplace_category_tab = (By.CSS_SELECTOR, '[path="/console/product/marketplaceCategory"]')
    # Registration页面tab
    registration_tab = (By.CSS_SELECTOR, '[path="/console/userRegistApproval"]')
    # Marketplace Product
    marketplace_product_tab = (By.CSS_SELECTOR, '[path="/console/product/marketplaceProducts"]')

    # 通用元素
    # 列表表头行
    thead_items = (By.XPATH, "//thead//th")
    # 列表产品名称查询条件输入框
    table_query_prodName_input = (By.XPATH, "//input[@placeholder='Product Name']")
    # 列表查询按钮
    table_query_trigger_button = (By.XPATH, "(//button[contains(@class, 'antd4-input-search-button')])[2]")
    # 列表数据行第一列
    table_row_first_col = (By.XPATH, "//tbody/tr[contains(@class, 'antd4-table-row')]/td[1]")
    # 成功气泡提示
    success_pup = (By.XPATH, "//div[contains(@class, 'antd4-message-success')]")


    # Product Category页面元素
    # 列表actions列Price Plan按钮
    product_category_table_actions_price_plan_button = (By.XPATH, "//span[starts-with(@class, 'nowrap')]/button[1]")
    # 列表actions列拓展按钮
    product_category_table_actions_ellipsis_button = (By.XPATH, "//span[starts-with(@class, 'nowrap')]/button[2]")
    # 列表actions列拓展操作按钮
    product_category_table_ellipsis_actions = (By.XPATH, "(//div[contains(@class,'antd4-dropdown')])[1]//span")
    # category list目录选项
    category_list_items = (By.XPATH, "//div[starts-with(@class, 'catalog-name')]")
    # edit抽屉项
    product_category_edit_drawer_item = (By.XPATH, "//label[@title]")
    # terms of service输入框
    terms_of_service_input = (By.XPATH, "//div[@data-slate-editor]")

    # insert link按钮
    insert_link_button = (By.XPATH, "//button[@data-menu-key='insertLink']")
    # link source输入框
    link_source_input = (By.XPATH, "//span[text()='Link source']/../input")
    # insert link确认按钮
    insert_link_confirm= (By.XPATH, "//div[@class='button-container']/button")
    # edit drawer确认按钮
    edit_drawer_confirm = (By.XPATH, "//div[@class='antd4-space-item']/button[contains(@class, 'antd4-btn-primary')]")

    # Marketplace Category页面元素
    # category_add_button
    category_add_button = (By.XPATH, "//div[contains(@class,'catalog-name-title')]//a")
    # 1_level_menu_name_input
    level_menu_name_input = (By.CSS_SELECTOR, '[id="basic_categoryName"]')
    # 确认按钮
    public_confirm_button = (By.XPATH, "//div[contains(@class,'modal-footer')]/button[2]")
    # category_name_input
    category_name_input = (By.CSS_SELECTOR, '[placeholder="Category Name"]')
    # 查询类别名称
    category_query_button = (By.XPATH, "(//button[contains(@class,'search-button')])[1]")
    # market_category_list
    market_category_list = (By.XPATH, "//span[contains(@class,'tree-node-content-wrapper-normal')]")
    # market_category_action
    market_category_action = (By.CSS_SELECTOR, '[class="anticon anticon-ellipsis"]')
    # operations
    operation_type = (By.XPATH, '//span[contains(@class,"antd4-dropdown-menu-title-content")]')
    # marketplace_confirm_button
    marketplace_confirm_button = (By.XPATH, "//div[contains(@class,'modal-confirm-btns')]/button[2]")
    # 操作提示
    operation_prompt = (By.XPATH, "//div[contains(@class,'antd4-message-success')]")
    # 新增sub menu名字输入框
    layer_sub_menu_name_input = (By.XPATH, "//input[@id='basic_categoryName' and contains(@class, 'antd4-input')]")
    # 新增sub menu保存
    layer_sub_menu_save_button = (By.XPATH, "//span[text()='Save']/..")
    # actions下拉按钮
    actions_dropdown_button = (By.XPATH, "//button[contains(@class, 'antd4-dropdown-trigger')]")
    # 编辑sub menu名字输入框
    edit_sub_menu_name_input = (By.XPATH, "//input[@id='categoryName' and contains(@class, 'antd4-input')]")
    # 删除sub menu确认
    delete_sub_menu_confirm_button = (By.XPATH, "//span[text()='Confirm']/..")


    # Registration页面元素
    # 加载动画
    loading_anime = (By.XPATH, "//span[contains(@class, 'antd4-spin-dot antd4-spin-dot-spin')]")
    # 表头行
    registration_thead_items = (By.XPATH, "//thead//th")
    # 筛选器展开按钮
    registration_filter_open_button = (By.XPATH, "//span[contains(@class, 'antd4-table-filter-trigger')]")

    # Marketplace Product页面元素
    # 表头行
    marketplace_product_thead_items = (By.XPATH, "//thead//th")